<?php

namespace app\api\controller;
use app\admin\model\Article;
use app\common\controller\Api;
use app\manystore\model\ManystoreShop;

/**
 * 升级
 */
class Upgrade extends Api
{
    protected $noNeedLogin = [''];
    protected $noNeedRight = '*';
    protected $model = null;
    public function _initialize()
    {
        parent::_initialize();
        $this->model = new \app\common\model\Upgraderules();
    }



    /*
     * 提报记录
     */
    public function upgrade_list(){
        $list=$this->model->order('id')->field('id,level_name')->select();

        $this->success('请求成功',$list);
    }


    public function upgrade_info()
    {
        $info = $this->model->where('id', input('id'))->find();
        $info['video_url'] =$info['video_url']==""?[]: explode(',', $info['video_url']);

        $imagesArray = $info['carousel_images']==""?[]: explode(',', $info['carousel_images']);
        $resultArray = [];
        foreach ($imagesArray as $url) {
            $resultArray[] = ['image' => trim($url)]; // 使用 trim 去除多余的空格
        }

        $info['carousel_images'] =$resultArray;
        $this->success('请求成功', $info);
    }





}
